﻿using Abp.Domain.Repositories;
using System.Linq;
using Teleware.Newbe.Navigation.Web.Domain.Entities;

namespace Teleware.Newbe.Navigation.Web.AppServices.Impl
{
    using Abp.Application.Services;

    public class HomeService : ApplicationService, IHomeService
    {
        private readonly IRepository<HrefInfo, string> _hrefInfosRepository;

        public HomeService(
            IRepository<HrefInfo, string> hrefInfosRepository)
        {
            _hrefInfosRepository = hrefInfosRepository;
        }

        public HomeIndexOutput GetData(HomeIndexGetDataInput input)
        {
            var re = new HomeIndexOutput
            {
                Items = new[]
                {
                    new HomeButtomGroup
                    {
                        Items = new[]
                        {
                            new SimpleHrefInfo
                            {
                                Name = "OA办公",
                                ImageName = "oa",
                                Href = "http://10.0.0.8",
                            },
                            new SimpleHrefInfo
                            {
                                Name = "知识库",
                                ImageName = "eip",
                                Href = "https://eip.teleware.cn",
                            },
                            new SimpleHrefInfo
                            {
                                Name = "企业邮箱",
                                ImageName = "mail",
                                Href = "http://mail.teleware.cn",
                            },

                            new SimpleHrefInfo
                            {
                                Name = "SSL-VPN",
                                ImageName = "vpn",
                                Href = "https://ssl.teleware.cn:4433",
                            },
                            new SimpleHrefInfo
                            {
                                Name = "虚拟机资源管理",
                                ImageName = "tcp",
                                Href = "http://10.0.7.118/tcp.web",
                            },
                            new SimpleHrefInfo
                            {
                                Name = "常用联系人和群组",
                                ImageName = "contact",
                            },
                        }
                    },
                    new HomeButtomGroup
                    {
                        Items = new[]
                        {
                            new SimpleHrefInfo
                            {
                                Name = "项目报工",
                                ImageName = "task",
                                Href = "https://pms.teleware.cn/tlwrwpfweb/Portal/UI.OA/Frames/pmlogin.aspx",
                            },
                            new SimpleHrefInfo
                            {
                                Name = "资源池",
                                ImageName = "resources",
                                Href = "https://task.teleware.cn/tlwrwpfweb/Portal/UI.OA/Frames/zylogin.aspx",
                            },
                            new SimpleHrefInfo
                            {
                                Name = "任务协同",
                                ImageName = "task",
                                Href = "https://task.teleware.cn/tlwrwpfweb/Portal/UI.OA/Frames/tasklogin.aspx",
                            },
                            new SimpleHrefInfo
                            {
                                Name = "组织级项目管理",
                                ImageName = "organization",
                                Href = "https://pms.teleware.cn/tlwrwpfweb/Portal/UI.OA/Frames/pmslogin.aspx",
                            },
                            new SimpleHrefInfo
                            {
                                Name = "TD缺陷管理",
                                ImageName = "td",
                                Href = "https://td.teleware.cn:999/tdbin/start_a.htm",
                            },
                            new SimpleHrefInfo
                            {
                                Name = "运维管理",
                                ImageName = "om",
                            },
                        }
                    },
                },
            };
            re.All = re.Items.SelectMany(x => x.Items).ToList();
            return re;
        }
    }
}
